package Day13;

import java.util.Scanner;
/**
 * 2021Java真题:括号序列
 * https://www.lanqiao.cn/problems/1456/learning/
 */
public class Main1 {
    public static final long MOD = (long) (1e9 + 7);
    public static long func(String s) {
        int n = s.length();
        long[][] dp = new long[n+2][n+2];
        dp[0][0] = 1;//辅助初始化，同时也可以具有实际意义
        for (int i = 1; i <= n; ++i){
            if (s.charAt(i-1) == '(') {
                for (int j = 1; j <= n; ++j) {  //读入左括号，不可能出现左与右相等的情况，从1开始
                    dp[i][j] = dp[i-1][j-1];
                }
            }else {
                dp[i][0] = (dp[i-1][0] + dp[i-1][1]) % MOD;//dp[i][0]带公式越界，用原方法判定
                for (int j = 1; j <= n; ++j) {
                    dp[i][j] = (dp[i-1][j+1] + dp[i][j-1]) % MOD;
                }
            }
        }
        //从小往大括号数递增，第一个非零方案对应的状态就是最少括号数的”恰好“合法串
        for (int i = 0; i < n; ++i) {
            if (dp[n][i] != 0) return dp[n][i];
        }
        return -1;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        long l = func(s);
        StringBuilder stringBuilder = new StringBuilder(s);
        stringBuilder.reverse();
        for (int i = 0; i < stringBuilder.length(); ++i) {
            if (stringBuilder.charAt(i) == '(') {
                stringBuilder.setCharAt(i, ')');
            }else {
                stringBuilder.setCharAt(i, '(');
            }
        }
        long r = func(stringBuilder.toString());
        System.out.println((l * r) % MOD);
    }
}